package com.example.websocket_demo.dao.user_apply_friend;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface UserApplyFriendDao {
    @Select("<script> select * from user_apply_friend where 1=1 <if test='id!=null'>and id=#{id} </if> <if test='user_id!=null'>and user_id=#{user_id} </if> <if test='verification_info!=null'>and verification_info=#{verification_info} </if> <if test='group_id!=null'>and group_id=#{group_id} </if> <if test='two_way!=null'>and two_way=#{two_way} </if> <if test='friend_id!=null'>and friend_id=#{friend_id} </if> <if test='remark!=null'>and remark=#{remark} </if> <if test='result!=null'>and result=#{result} </if>  <if test='dr!=null'>and dr=#{dr} </if> </script>")
    public List<Map<String,Object>> selectApplyFriend(Map<String,Object> map);
    @Insert("<script> insert into user_apply_friend <trim prefix='(' suffix=')' suffixOverrides=','> <if test='user_id != null and user_id != \"\"'>user_id,</if> <if test='verification_info != null and verification_info != \"\"'>verification_info,</if> <if test='group_id != null and group_id != \"\"'>group_id,</if> <if test='friend_id != null and friend_id != \"\"'>friend_id,</if> <if test='remark != null and remark != \"\"'>remark,</if> </trim> <trim prefix='values (' suffix=')' suffixOverrides=','> <if test='user_id != null and user_id != \"\"'>#{user_id},</if> <if test='verification_info != null and verification_info != \"\"'>#{verification_info},</if> <if test='group_id != null and group_id != \"\"'>#{group_id},</if> <if test='friend_id != null and friend_id != \"\"'>#{friend_id},</if> <if test='remark != null and remark != \"\"'>#{remark},</if> </trim> </script>")
    public int insertApplyFriend(Map<String, Object> userMap);
}
